package com.itheima.autoconfig;

import com.itheima.autoconfig.properties.AipFaceProperties;
import com.itheima.autoconfig.properties.HuanXinProperties;
import com.itheima.autoconfig.properties.OssProperties;
import com.itheima.autoconfig.properties.SmsProperties;
import com.itheima.autoconfig.template.AipFaceTemplate;
import com.itheima.autoconfig.template.HuanXinTemplate;
import com.itheima.autoconfig.template.OssTemplate;
import com.itheima.autoconfig.template.SmsTemplate;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * @author 芝士雪豹
 * @create 2022/9/19/9:57
 */

/**
 * 自动装配类 用于指定 Properties
 */
@EnableConfigurationProperties({
        SmsProperties.class,
        OssProperties.class,
        AipFaceProperties.class,
        HuanXinProperties.class
})
public class TanhuaAutoConfiguration {
    @Bean
    public SmsTemplate smsTemplate(SmsProperties smsProperties) {
        return new SmsTemplate(smsProperties);
    }

    @Bean
    public OssTemplate ossTemplate(OssProperties ossProperties) {
        return new OssTemplate(ossProperties);
    }

    @Bean
    public AipFaceTemplate aipFaceTemplate() {
        return new AipFaceTemplate();
    }

    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties huanXinProperties) {
        return new HuanXinTemplate(huanXinProperties);
    }
}
